
export const upgradeCheck = () => {
  // console.log("App Launch");
  if (uni.canIUse("getUpdateManager")) {
    const updateManager = uni.getUpdateManager();
    updateManager.onCheckForUpdate((res) => {
      if (res.hasUpdate) {
        updateManager.onUpdateReady(() => {
          uni.showModal({
            title: "新版本已经发布啦",
            content: "请点击确认重新加载小程序",
            success: (res) => {
              res.confirm && updateManager.applyUpdate();
            },
          })
        })
        updateManager.onUpdateFailed(() => {
          uni.showModal({
            title: "新版本已经发布啦",
            content: "您可以删除当前小程序，重新搜索打开最新版本，或无需操作等待自动更新",
          })
        })
      }
    })
  }
}

export const getSystemInfo = (opt = {}) => uni.getSystemInfo(opt)

export const getAccountInfoSync = () => uni.getAccountInfoSync()

export const openSetting = (opt = {}) => uni.openSetting(opt)

export const login = () => uni.login()

export const copy = data => uni.setClipboardData({ data })
